#include"string.h"
void test01() {
	wz::string s1;
	cout << s1.c_str() << endl;
	wz::string s2("hello worldxxx");
	cout << s2.c_str() << endl;
	wz::string s3(s2);
	cout << s3.c_str() << endl;
}
void test02() {
	wz::string s1("hello world");
	cout << s1[0] << endl;
	for (size_t i = 0; i < s1.size(); i++)
	{
		cout << s1[i]<<' ';
	}
	cout << endl;
}
void test03() {
	wz::string s1("hello world");
	s1.reserve(20);
	cout << s1.c_str() << endl;
}
void test04() {
	wz::string s1("hello world");
	s1.push_back('x');
	s1.push_back('x');
	cout << s1.c_str() << endl;
	wz::string s2;
	s2.push_back('x');
	cout << s2.c_str() << endl;

}
void test05() {
	wz::string s1("hello world");
	s1.append("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
	cout << s1.c_str() << endl;
	wz::string s2;
	s2 += "xxx";
	cout << s2.c_str() << endl;
}
void test06() {
	wz::string s1("hello world");
	s1.insert(0, 'c');
	s1.insert(4, 'c');
	s1.insert(7, 'c');
	cout << s1.c_str() << endl;
	wz::string s2("hello world");
	s2.insert(2, "xx");
	cout << s2.c_str() << endl;
}
void test07() {
	wz::string s1("hello world");
	s1.erase(4,1);
	cout << s1.c_str() << endl;
	wz::string s2("hello world");
	for (size_t i = 0; i < s2.size(); i++)
	{
		cout << s2.find('l', i) << ' ';
	}
	cout << endl;
	cout << s2.find(" w",3) << endl;

}
void test08() {
	string s1("hello world");
	string s2 = s1.substr(0, 4);
	cout << s2 << endl;
}
int main() {
	//test01();
	//test02();
	//test03();
	//test04();
	//test05();
	//test06();
	//test07();
	test08();
	return 0;
}